use base_demo::shapes::{Circle, Rectangle, Area};
use base_demo::algorithms::Sorter;

#[test]
fn test_shapes_intergration() {
    let shapes: Vec<Box<dyn Area>> = vec![
        Box::new(Rectangle::new(10.0, 20.0)),
        Box::new(Circle::new(5.0)),
    ];

    let total_area: f64 = shapes.iter().map(|s| s.area()).sum();
    assert!(total_area > 278.0 && total_area < 279.0);
}

#[test]
fn test_sorter_intergration() {
    let mut data = vec![
        ("Bob", 25),
        ("Alice", 30),
        ("Charlie", 20),
    ];

    Sorter::sort(&mut data);
    assert_eq!(data[0].0, "Alice");
    assert_eq!(data[1].0, "Bob");
    assert_eq!(data[2].0, "Charlie");
}